package spring;

import org.springframework.context.support.ClassPathXmlApplicationContext;

//import org.springframework.context.ApplicationContext;
//import org.springframework.context.support.FileSystemXmlApplicationContext;

public class Business {
	private IWriter writer;
	
	private String msg="strmessage";

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public void setWriter(IWriter writer) {
		this.writer = writer;
	}

	public void save() {
		System.out.println("业务数据保存");
		writer.save();
	}
	
	public static void main(String[] args) {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
				"applicationContext.xml");
		// ApplicationContext context = new
		// FileSystemXmlApplicationContext("src/applicationContext.xml");
		Business business = (Business) context.getBean("business");
		System.out.println(business.getMsg());
		business.save();
	}
}
